Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance Improvement 1 - Reduce number of pure calls. #986

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

JCWasmx86
Copy link
Contributor

is_ignored_block_opening(config, item) and is_safe_closing_tag(config, item) are each called multiple times in indent.py with the same parameters. This can be deduplicated.

(Note I've changed the block with executor_cls(max_workers=worker_count) as exe: in __init__.py to be serial to make the profiler work.

for this_file in file_list:
  file_errors.append(process(config, this_file))
  # if temp_file block etc. is removed

Before:

image

is_ignored_block_opening (With children): 12.4% of all the time, 61562x calls
is_safe_closing_tag (With children): 6.24% of all the time, 33139x calls

Concrete data:

Netbox with serial execution (Patch above): 9.7s
Netbox with unchanged __init__.py              :    4s
OpenEDX platform                                           : 33s

After

image

is_ignored_block_opening (With children): 4.73% of all the time, 20622x calls
is_safe_closing_tag (With children): 4.61% of all the time, 20941x calls

Concrete data:

Netbox with serial execution (Patch above): 8.3s
Netbox with unchanged __init__.py              : 3.5s
OpenEDX platform                                           : 26s

Copy link

netlify bot commented Oct 31, 2024

Deploy Preview for djlint ready!

Name Link
🔨 Latest commit c0b7c3e
🔍 Latest deploy log https://app.netlify.com/sites/djlint/deploys/6724597c1868b6000884c5e2
😎 Deploy Preview https://deploy-preview-986--djlint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@JCWasmx86 JCWasmx86 force-pushed the perf-1 branch 3 times, most recently from 40c6271 to 9a74675 Compare October 31, 2024 16:11
@JCWasmx86
Copy link
Contributor Author

I will submit PRs for each of the 5 points on its own

@monosans monosans enabled auto-merge (squash) November 1, 2024 06:38
@monosans monosans merged commit 69638ce into djlint:master Nov 1, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants